package park;

import java.util.Scanner;

public class J10SungJuk {
	
	public static void main(String [] args){
		
		//return을 이용한 메서드
		//주의 : Scanner 클래스를 이용해서 입력처리하고 close()를 하면 다시 Scanner 생성 불가
		
			//String name[] = new String[2]
		int kor = 0;
		int eng = 0;
		int mat = 0;
			//int point[] = new int[3+1];
		int tot;
		double avg;
		char grd =' ';
		String name=null;
		String result=null;
		
		
		
		/*Scanner sc = new Scanner(System.in);
		System.out.println("성적처리 프로그램에 오신걸 환영합니다");
		System.out.println("국어점수를 입력해주세요");
		kor = sc.nextInt();
		System.out.println("영어점수를 입력해주세요");
		eng = sc.nextInt();
		System.out.println("수학점수를 입력해주세요");
		mat = sc.nextInt();*/
		
		name = inputName(makeScanner());
		kor = inputKor(makeScanner());
		eng = inputEng(makeScanner());
		mat = inputMat(makeScanner());
		tot = getTot(kor , eng , mat);
		avg = getAvg(tot);
		grd = getGrd(avg, grd);
	
		
		
		
		
		System.out.println("총 점수의 합은"+tot+"입니다");
		System.out.println("평균은"+avg+"입니다");
		System.out.println("학점은"+grd+"입니다");
		
		
		if(grd != '수'){
			
			System.out.println("점수가 바닥이군요 공부 열심이 하세요");
		
		}
	
	}
		
		


	// Scanner 생성
			
		public static Scanner makeScanner(){
			Scanner sc = new Scanner(System.in);
			return sc;
		}
		
	// Scanner 소멸
		public static void closeScanner(
				Scanner sc){
			sc.close();	
			
		}
	
	private static int inputMat(Scanner sc) {
		int mat;
		System.out.println("수학는?");
		mat = sc.nextInt();
		closeScanner(sc);
		return mat;
	}


	private static int inputEng(Scanner sc) {
		int eng;
		System.out.println("영어는?");
		eng = sc.nextInt();
		return eng;
	}


	private static int inputKor(Scanner sc) {
		int kor;
		System.out.println("국어는?");
		kor = sc.nextInt();
		return kor;
	}


	private static String inputName(Scanner sc) {

		String name;
		System.out.println("이름은?");
		name = sc.next();
		return name;
	}


	private static char getGrd(double avg , char grd) {
		
			switch((int)avg/10){
			case 10:
			case 9:grd='수';break;
			case 8:grd='우';break;
			case 7:grd='미';break;
			case 6:grd='양';break;
			default :grd='가';

		}
		
		return grd;
		
	}

	private static double getAvg(double tot) {
		
		return (tot/3);
	}

	private static int getTot(int kor , int eng , int mat) {

		return (kor + eng + mat);
	}

}
